home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / XCMDs and XFCNs / ScreenWidth XFCN 1.0.0 / ScreenWidth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-25  |  837 b   |  45 lines  |  [TEXT/MPS ]

  1. /* ----------------------------------------------------------------------
  2.  
  3.     ScreenWidth XFCN
  4.     version 1.0
  5.     25 September
  6.     
  7.     Written by: Paul Celestin
  8.     
  9.     Copyright © 1993 Celestin Company
  10.     All Rights Reserved
  11.     
  12.     This XFCN returns the width of the main screen in pixels.
  13.     
  14.     930925 - 1.0.0 - initial release
  15.  
  16. ---------------------------------------------------------------------- */
  17.  
  18. # include    <HyperXCMD.h>
  19. # include    <QuickDraw.h>
  20. # include    <SetUpA4.h>
  21.  
  22. pascal void main(XCmdPtr paramPtr)
  23. {
  24.     long        width;
  25.     StringPtr    myString;
  26.     GDHandle    curDev;
  27.     Rect        bounds;
  28.  
  29.      RememberA0();
  30.      SetUpA4();
  31.      
  32.     if (paramPtr->paramCount == 0)
  33.     {
  34.  
  35.         curDev = GetMainDevice();
  36.         bounds = (**curDev).gdRect;
  37.         width = bounds.right - bounds.left;
  38.  
  39.         NumToStr(paramPtr,width,myString);
  40.         paramPtr->returnValue = PasToZero(paramPtr,myString);
  41.     }
  42.     
  43.     RestoreA4();
  44. }
  45.